package com.yanqu.road.server.cmd.union.cross.honors;

import com.yanqu.road.entity.union.honors.UnionHistoryHonorsRecordData;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.union.cross.CrossUnionHonorsProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.union.honors.CrossUnionHonorsMgr;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.utils.string.StringUtils;

@Cmd(code = CrossProtocol.C_CROSS_UNION_GROUP_ACTIVITY_GET_RANK_UNION_NAMES_BACK, desc = "获取参与活动的商会-返回")
public class UnionGroupActivityRankUnionNamesBackCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        CrossUnionHonorsProto.UnionGroupActivityRankUnionNamesRespMsg respMsg = CrossUnionHonorsProto.UnionGroupActivityRankUnionNamesRespMsg.parseFrom(packet.getBytes());

        UnionHistoryHonorsRecordData recordData = CrossUnionHonorsMgr.getUnionHistoryHonorsRecordData(respMsg.getUnionUid(), respMsg.getActivityId());
        if(recordData != null){
            if(StringUtils.isNullOrEmpty(recordData.getUnionNames())){
                recordData.setUnionNames(respMsg.getUnionNames());
            }
        }

    }

    @Override
    public void sendData() {

    }
}
